gccfandomcom_ja-20200214-history
Struct cpp reader
このページを編集する際は，編集に関する方針に従ってください． 概要 *gcc-4.1.0/libcpp/internal.hにて定義 * 実装 300 /* A cpp_reader encapsulates the "state" of a pre-processor run. 301 Applying cpp_get_token repeatedly yields a stream of pre-processor 302 tokens. Usually, there is only one cpp_reader object active. */ 303 struct cpp_reader 304 { 305 /* Top of buffer stack. */ 306 cpp_buffer *buffer; 307 308 /* Overlaid buffer (can be different after processing #include). */ 309 cpp_buffer *overlaid_buffer; 310 311 /* Lexer state. */ 312 struct lexer_state state; 313 314 /* Source line tracking. */ 315 struct line_maps *line_table; 316 317 /* The line of the '#' of the current directive. */ 318 source_location directive_line; 319 320 /* Memory buffers. */ 321 _cpp_buff *a_buff; /* Aligned permanent storage. */ 322 _cpp_buff *u_buff; /* Unaligned permanent storage. */ 323 _cpp_buff *free_buffs; /* Free buffer chain. */ 324 325 /* Context stack. */ 326 struct cpp_context base_context; 327 struct cpp_context *context; 328 329 /* If in_directive, the directive if known. */ 330 const struct directive *directive; 331 332 /* Token generated while handling a directive, if any. */ 333 cpp_token directive_result; 334 335 /* Search paths for include files. */ 336 struct cpp_dir *quote_include; /* "" */ 337 struct cpp_dir *bracket_include; /* <> */ 338 struct cpp_dir no_search_path; /* No path. */ 339 340 /* Chain of all hashed _cpp_file instances. */ 341 struct _cpp_file *all_files; 342 343 struct _cpp_file *main_file; 344 345 /* File and directory hash table. */ 346 struct htab *file_hash; 347 struct htab *dir_hash; 348 struct file_hash_entry *file_hash_entries; 349 unsigned int file_hash_entries_allocated, file_hash_entries_used; 350 351 /* Nonzero means don't look for #include "foo" the source-file 352 directory. */ 353 bool quote_ignores_source_dir; 354 355 /* Nonzero if any file has contained #pragma once or #import has 356 been used. */ 357 bool seen_once_only; 358 359 /* Multiple include optimization. */ 360 const cpp_hashnode *mi_cmacro; 361 const cpp_hashnode *mi_ind_cmacro; 362 bool mi_valid; 363 364 /* Lexing. */ 365 cpp_token *cur_token; 366 tokenrun base_run, *cur_run; 367 unsigned int lookaheads; 368 369 /* Nonzero prevents the lexer from re-using the token runs. */ 370 unsigned int keep_tokens; 371 372 /* Error counter for exit code. */ 373 unsigned int errors; 374 375 /* Buffer to hold macro definition string. */ 376 unsigned char *macro_buffer; 377 unsigned int macro_buffer_len; 378 379 /* Descriptor for converting from the source character set to the 380 execution character set. */ 381 struct cset_converter narrow_cset_desc; 382 383 /* Descriptor for converting from the source character set to the 384 wide execution character set. */ 385 struct cset_converter wide_cset_desc; 386 387 /* Date and time text. Calculated together if either is requested. */ 388 const unsigned char *date; 389 const unsigned char *time; 390 391 /* EOF token, and a token forcing paste avoidance. */ 392 cpp_token avoid_paste; 393 cpp_token eof; 394 395 /* Opaque handle to the dependencies of mkdeps.c. */ 396 struct deps *deps; 397 398 /* Obstack holding all macro hash nodes. This never shrinks. 399 See identifiers.c */ 400 struct obstack hash_ob; 401 402 /* Obstack holding buffer and conditional structures. This is a 403 real stack. See directives.c. */ 404 struct obstack buffer_ob; 405 406 /* Pragma table - dynamic, because a library user can add to the 407 list of recognized pragmas. */ 408 struct pragma_entry *pragmas; 409 410 /* Call backs to cpplib client. */ 411 struct cpp_callbacks cb; 412 413 /* Identifier hash table. */ 414 struct ht *hash_table; 415 416 /* Expression parser stack. */ 417 struct op *op_stack, *op_limit; 418 *ユーザから見えるオプション 419 /* User visible options. */ 420 struct cpp_options opts; 421 422 /* Special nodes - identifiers with predefined significance to the 423 preprocessor. */ 424 struct spec_nodes spec_nodes; 425 426 /* Whether cpplib owns the hashtable. */ 427 bool our_hashtable; 428 429 /* Traditional preprocessing output buffer (a logical line). */ 430 struct 431 { 432 unsigned char *base; 433 unsigned char *limit; 434 unsigned char *cur; 435 source_location first_line; 436 } out; 437 438 /* Used for buffer overlays by traditional.c. */ 439 const unsigned char *saved_cur, *saved_rlimit, *saved_line_base; 440 441 /* A saved list of the defined macros, for dependency checking 442 of precompiled headers. */ 443 struct cpp_savedstate *savedstate; 444 };